#!/usr/bin/env ruby
# frozen_string_literal: true

# Insert our system Ruby patch script, if neeeded.
# Fixes universal-ruby getting confused whether to install arm64 or x86_64 macOS versions.
# https://github.com/rubygems/rubygems/issues/4234
if RUBY_PLATFORM.match?(/universal\..*-darwin/)
  rubylib = File.expand_path("../../rubyext", File.dirname(__FILE__))
  ENV["RUBYLIB"] = rubylib
  $LOAD_PATH.unshift(rubylib) unless $LOAD_PATH.include?(rubylib)
  require "rubygems/defaults/operating_system" if defined?(Gem) # Reload if already loaded.
end

require "rubygems"
load Gem.activate_bin_path("bundler", "bundle", ">= 0.a")
